<template>
  <div class="home">
      <el-main>
        <el-row>
          <div id="week_chart" class="echarts"></div>
        </el-row>
      </el-main>
  </div>
</template>
<script>
export default {
  name: 'charts',
  data () {
    return {
      loading: true
    }
  },
  mounted: function () {
    this.onInitEchart1()
  },
  methods: {
    onInitEchart1 () {
      let echarts = require('echarts')
      let myChart = echarts.init(document.getElementById('week_chart'), 'walden')
      let option = {
        tooltip: {
          trigger: 'axis',
          formatter: '{b}: {c} ({d}%)'
        },
        title: {
            left: 'center',
            text: '周报',
        },
        toolbox: {
            feature: {
                dataZoom: {
                    yAxisIndex: 'none'
                },
                restore: {},
                saveAsImage: {}
            }
        },
        xAxis: {
            type: 'category',
            boundaryGap: false,
            data: date
        },
        yAxis: {
            type: 'value',
            boundaryGap: [0, '100%']
        },
        dataZoom: [{
            type: 'inside',
            start: 90,
            end: 100
        }, {
            start: 90,
            end: 100
        }],
        series: [
          {
            name: '总金额',
            type: 'line',
            symbol: 'none',
            sampling: 'lttb',
            itemStyle: {
                color: 'rgb(255, 70, 131)'
            },
            areaStyle: {
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                    offset: 0,
                    color: 'rgb(255, 158, 68)'
                }, {
                    offset: 1,
                    color: 'rgb(255, 70, 131)'
                }])
            },
            data: data
          }
        ]
      }
      myChart.setOption(option)
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
  font-weight: normal;
}

ul {
  list-style-type: none;
  padding: 0;
}

li {
  display: inline-block;
  margin: 0 10px;
}

a {
  color: #42b983;
}
</style>
